
<html>
  <head> 
    <title>Disco Inferno</title>
    <script src="static/lib/closure-library/closure/goog/base.js"></script>
    
    <script src="static/js/application.js"></script>
    
    <script src="static/js/model/question.js"></script>
    <script src="static/js/ui/questionpane.js"></script>
    <link href="static/css/core.css" rel="stylesheet" type="text/css" />
  </head>
  <body>
    <img src="static/img/logo.png"></img>
    <a style="text-decoration: none;" id="score-link" href="/leaders?score=0">
      <div id="score-pane" style="color: white; font-size: 30px;">
        Score: 0
      </div>
    </a>
    <div id="question-pane">
    </div> 
    <script>
      function main() {
        //goog.require('discoinferno.Application');
        //goog.require('discoinferno.model.Question');
        //goog.require('discoinferno.ui.QuestionPane');
        //goog.require('goog.Timer');
        timer = new goog.Timer(3000);
        app = new discoinferno.Application('question-pane', timer);
        app.startQuestion();
      }
      function chooseAnswer(answerNum) {
        var rightAnswer = app.currentRightAnswer;
        goog.dom.classes.set(goog.dom.getElement('image'+rightAnswer), 'right');
        score = 9000-((new Date()).getTime() - app.startTime);
        if(rightAnswer == answerNum) {
          console.log('correct');
        }
        else {
          goog.dom.classes.set(goog.dom.getElement('image' + answerNum), 'wrong');
          score = 0;
        }
        //report score
        app.playerScore += score;
        goog.dom.setTextContent(goog.dom.getElement('score-pane'), 'Score: ' + app.playerScore);
        goog.dom.getElement('score-link').setAttribute('href', '/leaders?score='+app.playerScore);
        timer.setInterval(500);
      }
      main(); 
    </script>
  </body>
</html>
